
	<link rel="stylesheet" type="text/css" href="../css/themSanPham.css" />
    <script type="text/javascript" src="../js/DEV_jquery-1.8.3.js"></script>
	<script type="text/javascript" src="../js/jquery-1.8.3.min.js"></script>
    <link rel="stylesheet" type="text/css" href="../css/slideshow.css" />

<script type="text/javascript" language="javascript" src="../js/jquery.cycle.all.js"></script>

    <script language="javascript">
	
		function themChiTietSanPham(){
			var id = $("#cmbLoaiSP").val();
			$.ajax({
				type: "GET",
				url: "themChiTietSanPham.php?idLoaiSP=" + id,
				dataType:"html",
				success: function(data){
					$("#loaiSP").html(data);
				},
				error: function(){
					alert("Error!");	
				}
			});
		}
	</script>
	<?php
		include_once("../DAO/DataProvider.php");
		include_once("../BUS/hangSXBUS.php");
		include_once("../DTO/hangSXDTO.php");
		include_once("../BUS/loaiSPBUS.php");
		include_once("../DTO/loaiSPDTO.php");
		if(isset($_SESSION["id"]))
		{
			$hangSXBUS = new hangSXBUS();
			$arrHangSXDTO = $hangSXBUS->Load_HangSX();
			
			$loaiSPBUS = new loaiSPBUS();
			$arrLoaiSPDTO = $loaiSPBUS->Load_LoaiSP();
			
		?>
        	
			<form action="xlThemSanPham.php" method="post">
            	<div class="tieuDe">.:Thông tin sản phẩm</div>
                <table width="990" border="0" cellspacing="0" cellpadding="1" align="center" >
                  <tr>
                    <td class="left" width="300">Tên sản phẩm:</td>
                    <td width="690">
                   	 <input type="text" name="txtTenSanPham" id="txtTenSanPham">
                    </td>
                  </tr>
                  <tr>
                    <td class="left">Hãng sản xuất:</td>
                    <td>
                      <select name="cmbHangSX" id="cmbHangSX">
                          <option value="">Vui lòng chọn...</option>
                          <?php
                            for($i=0; $i<count($arrHangSXDTO); $i++)
                            {
                                ?>
                                <option value="<?php echo $arrHangSXDTO[$i]->idHangSX; ?>">
                                <?php echo $arrHangSXDTO[$i]->tenHangSX; ?>
                                </option>
                                <?php
                            }
                          
                          ?>
                      </select>
                    </td>
                  </tr>
                  	  <td class="left">Loại sản phẩm:</td>
                      <td>
                      <select name="cmbLoaiSP" id="cmbLoaiSP" onChange="themChiTietSanPham()">
                      <option value="">Vui lòng chọn...</option>
                      <?php
						for($i=0; $i<count($arrLoaiSPDTO); $i++)
						{
							?>
                            <option value="<?php echo $arrLoaiSPDTO[$i]->idLoaiSP; ?>" >
                            <?php echo $arrLoaiSPDTO[$i]->tenLoaiSP; ?>
                            </option>
                            <?php
						}
					  
					  ?>
                      </select>
                    </td>
                  <tr>
                  </tr>
                  <tr>
                    <td class="left">Giá bán:</td>
                    <td>
                    	<input type="text" name="txtGia" id="txtGia">
                    </td>
                  </tr>
                  <tr>
                    <td class="left">Số lượng:</td>
                    <td>
                    	<input type="text" name="txtSoLuong" id="txtSoLuong">
                    </td>
                  </tr>
         		</table>
                <div class="tieuDe">.: Chi tiết sản phẩm</div>
                <div id="txtHint">
                	
                    
                    <div id="loaiSP">
                    	Vui lòng chọn loại sản phẩm
                    </div>
               
                 <table width="990" border="0" cellspacing="0" cellpadding="1" align="center" >
                  <tr>
                  </tr>
                  <tr>
                    <td class="left">
                    	<input type="submit" name="btnSubmit" id="btnSubmit" value="Đồng ý">
                    </td>
                    <td>
                    	<input type="reset" name="btnReset" id="btnReset" value="Hủy">
                    </td>
                  </tr>
                </table>
            </form>
       	<?php
		}
		else
		{
			DataProvider::ChangeURL("../pages/index.php");
		}
	?>
    




